package com.cmc.cloud.cmclink.doc.convert;

import java.util.List;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import com.cmc.cloud.cmclink.doc.entity.BlnoDO;
import com.cmc.cloud.cmclink.doc.entity.ConfirmNoticeDO;
import com.cmc.cloud.cmclink.doc.vo.confirmnoticevo.ConfirmNoticeCreateReqVO;
import com.cmc.cloud.cmclink.doc.vo.confirmnoticevo.ConfirmNoticeRespVO;
import com.cmc.cloud.cmclink.doc.vo.confirmnoticevo.ConfirmNoticeUpdateReqVO;

/**
 * 确认装货港更改通知 Convert
 *
 * @author 集运管理员
 */
@Mapper
public interface ConfirmNoticeConvert {
    /**
     * 获取转换接口的实例
     */
    ConfirmNoticeConvert INSTANCE = Mappers.getMapper(ConfirmNoticeConvert.class);

    /**
     * 将创建请求VO转换为DO
     *
     * @param bean 创建请求VO
     * @return DO
     */
    ConfirmNoticeDO convert(ConfirmNoticeCreateReqVO bean);

    /**
     * 将更新请求VO转换为DO
     *
     * @param bean 更新请求VO
     * @return DO
     */
    ConfirmNoticeDO convert(ConfirmNoticeUpdateReqVO bean);

    /**
     * 将DO转换为查询响应VO
     *
     * @param bean DO
     * @return VO
     */
    ConfirmNoticeRespVO convert(ConfirmNoticeDO bean);

    /**
     * 将DO列表转换为查询响应VO列表
     *
     * @param list DO列表
     * @return VO List
     */
    List<ConfirmNoticeRespVO> convertList(List<ConfirmNoticeDO> list);

    /**
     * list转换
     *
     * @param list list
     * @return List
     */
    List<ConfirmNoticeDO> convertFromBlno(List<BlnoDO> list);

    /**
     * list转换
     *
     * @param blno blno
     * @return List
     */
    @Mappings(value = {@Mapping(target = "blnoId", source = "id"), @Mapping(target = "notice", constant = "FCN"),
        @Mapping(target = "status", constant = "PENDING"), @Mapping(target = "operateType", constant = "NOTICE"),
        @Mapping(target = "id", ignore = true)})
    ConfirmNoticeDO convert(BlnoDO blno);
}
